package fei.yuzhi.com.loveflowers.ui.ProductActivity;

import java.util.List;

import fei.yuzhi.com.loveflowers.bean.ProductBean;

/**
 * Created by Administrator on 2016/10/9.
 */
public class ProductPresenter implements ProductContract.ProductPresenter{
    private ProductContract.ProductView view;
    private ProductContract.ProductModle modle;
    private String keyword;
    private int page;

    public ProductPresenter(int page,String keyword,ProductContract.ProductView view){
        this.view=view;
        this.modle=new ProductModle();
        this.keyword=keyword;
        this.page=page;
    }

    @Override
    public void ProductConnected() {
        modle.getProductBean(page,keyword, new ProductModle.loadProductBean() {
            @Override
            public void sendProductBean(List<ProductBean.DatasBean.GoodsListBean> list) {
                view.onGetProductBeanSuccess(list);
            }
        });
    }

    @Override
    public void ProductPriceConnected() {
        modle.getProductPrice(page,keyword, new ProductModle.loadProductPriceBean() {
            @Override
            public void sendProductPriceBean(List<ProductBean.DatasBean.GoodsListBean> list) {
                view.onGetProductPriceSuccess(list);
            }
        });
    }

    @Override
    public void ProductSaleConnected() {
        modle.getProductSale(page,keyword, new ProductModle.loadProductSaleBean() {
            @Override
            public void sendProductSaleBean(List<ProductBean.DatasBean.GoodsListBean> list) {
                view.onGetProductSaleSuccess(list);
            }
        });
    }

}
